package com.ljt.business.controller;


import com.ljt.business.service.ProductCategoryService;
import com.ljt.response.Result;
import com.ljt.utils.ProductCategoryMenuTree;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author ljt
 * @since 2021-07-05
 */
@RestController
@RequestMapping("/productCategory")
@Api(value = "物资类别模块",tags = "物资类别接口")
public class ProductCategoryController {

    @Autowired
    private ProductCategoryService productCategoryService;

    /**
     * 获取物资类别树形数据
     * @return Result
     */

    @GetMapping("/getProductCategoryMenuTree")
    @ApiOperation(value = "获取物资类别树形数据",notes = "根据表中的父编号封装成前端树形控件可以使用的数据结构")
    public Result getProductCategoryMenuTree() {
        List<ProductCategoryMenuTree> productCategoryMenuTree = productCategoryService.getProductCategoryMenuTree();
        return Result.ok().data("productCategoryMenuTree", productCategoryMenuTree);
    }
}

